﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Emerson.Storage.Agent.Core;
using System.Configuration;

namespace Emerson.Storage.Service
{
    public class AgentAccess
    {
        static readonly int AgentPort;

        static AgentAccess()
        {
            AgentPort = int.Parse(ConfigurationManager.AppSettings["AgentPort"]);
        }

        public static IAgentService GetAgentService(string address)
        { 
            IAgentService agentService = (IAgentService)Activator.GetObject(typeof(IAgentService),
                           "tcp://" + address + ":" + AgentPort.ToString() + "/EmersonStorageAgent");

            return agentService;
        }
    }
}
